<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name='apple-touch-fullscreen' content='yes'>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta content="fullscreen=yes,preventMove=no" name="ML-Config">
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no,email=no,address=no" />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>商品详情</title>
    <link rel="stylesheet" href="/style/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="/style/css/sweet-alert.css"/>
    <script src="/style/js/jQuery.v1.8.3.min.js"></script>
    <script src="/style/js/index.js"></script>
    <script src="/style/js/sweet-alert.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<style>
    .footer-right{
	
    	background: #ff0000;
    }
    
    .footer-right p{
    	line-height:1.05rem;
    }
    #buy_time{
	
    	display:none;
    }
 .cd-popup {
  position: fixed;  left: 0;  top: 0;  height: 100%;  width: 100%;  background-color: rgba(94, 110, 141, 0.9);  opacity: 0;  visibility: hidden;  -webkit-transition: opacity 0.3s 0s, visibility 0s 0.3s;  -moz-transition: opacity 0.3s 0s, visibility 0s 0.3s;  transition: opacity 0.3s 0s, visibility 0s 0.3s; z-index: 999;}
.cd-popup.is-visible {
   opacity: 1;
   visibility: visible;
  -webkit-transition: opacity 0.3s 0s, visibility 0s 0s;  -moz-transition: opacity 0.3s 0s, visibility 0s 0s;  transition: opacity 0.3s 0s, visibility 0s 0s;  }
    .cd-popup-container{position: relative;  width:100%;height:100%; overflow: scroll;}
    .cd-popup-cler{width:60px;height:57px;border: 1px solid transparent;background-color: #6085A0;border-radius: 8px;color: #fff;font-family: Arial, "微软雅黑";font-size: 15px;text-align: center;line-height: 57px;display: inline-block;margin-left: 14px;cursor: pointer;}
</style>
<body>
<div  style="background: #cacaca" id="vm">
    <header class="top">
        <h2><i style="float: left;">商品名称：</i><b style="font-weight: normal;width: 7rem;display: inline-block;"><?=$this->data['goods_name']; ?></b></h2>
        <p>
            <i>封顶价</i>
            <em>¥<?=$this->data['pat_max_price']?></em>
        </p>
        <p>
            <i>生产周期<em><?=$this->data['pat_period_day']?></em>天</i>
        </p>
    </header>
    <div class="adv-nav">
        <div class="adv-nav-left">
            <div class="adv-title">
                最新价
            </div>
            <div class="adv-price">
                ¥ <span id="new_price"><?= $this->pats[0]['bid_price'] >0 ?$this->pats[0]['bid_price']:$this->data['pat_min_price'];?></span>
            </div>
        </div>
        <div class="adv-nav-right">
            <p>距离结束仅剩</p>
            <span class="down_time"></span>
            
        </div>
    </div>
    <div class="adv-record">
       <a href="pat_records?goods_id=<?=$this->data['goods_id'];?>">
        <div class="record-top">
            <h4>跳价记录</h4>
            <img src="/style/images/login/sy-02.png" alt="" />
        </div>
       </a>
        <div class="record-main">
        <?php 
           if($this->pats){
           foreach($this->pats as $k=>$r){
        
        
        ?>
            <div class="<?=$k==0?'main-red':'main-blue';?>">
                <h6></h6>
                <span><?=$r['name']?></span>
                <b><?=$k==0?'领先':'出局'; ?></b>
                <i>出价 ¥ <?=$r['bid_price']?></i>
                <em>补偿 ¥ <?=$r['equalize_price']?></em>
            </div>
            <?php
             }
            }
            ?>
        </div>
    </div>
    <div class="adv-list">
        <ul>
            <li>
                <div class="li-left">
                    <span>起 P 价</span>
                    <em>¥ <?=intval($this->data['pat_min_price'])?></em>
                </div>
                <div class="li-right">
                    <span>固定跳价幅度</span>
                    <em style="padding-right: 0.6rem">¥ <?=intval($this->data['pat_fixed_price'])?></em>
                </div>
            </li>
            <li>
                <div class="li-left">
                    <span>保证Jin<i>(九云币)</i></span>
                    <em><?=intval($this->data['pat_guarantee_price']) ?></em>
                </div>
                <div class="li-right">
                    <span>竟拍倒计时</span>
                    <em><?=$this->data['pat_total_min'] ?>分钟</em>
                </div>
            </li>
        </ul>
    </div>
    <a href="/index/goodsdetail?goods_id=<?=$this->data['goods_id']?>">
    <div class="detail-adv">
        <h4>图文详情</h4>
        <img src="/style/images/login/sy-02.png" alt=""/>
    </div>
    </a>
    <div class="detail-main">
        <ul>
            <li>
                <img src="/style/images/login/detail.png" alt=""/>
                <span>零风险</span>
            </li>
            <li>
                <img src="/style/images/login/detail.png" alt=""/>
                <span>正品承诺</span>
            </li>
            <li>
                <img src="/style/images/login/detail.png" alt=""/>
                <span>极速发货</span>
            </li>
            <li>
                <img src="/style/images/login/detail.png" alt=""/>
                <span>公平公正</span>
            </li>
        </ul>
    </div>
    <div class="detail-content">
        参与竟拍 可获得固定跳价幅度<em><?=$this->config['my_pat'];?>%</em> 的补偿
    </div>
    <!--这里是切换-->
    <div class="switch">
        <ul class="switch-menu">
            <a href="###" class="coo">晒单分享</a>
            <a href="###">往期成交</a>
            <a href="###">玩家规则</a>
        </ul>
        <div class="swiper-container">
            <div class="swiper-wrapper">
                <p><img src="/style/images/pat/detail.jpg" class="imge"></p>
            </div>
            <div class="swiper-wrapper" style="display: none;">
                <p><img src="/style/images/pat/detail.jpg"></p>
               
            </div>
            <div class="swiper-wrapper"  style="display: none;">
                <p><img src="/style/images/pat/detail.jpg"></p>
                
            </div>
        </div>
    </div>
<!--  -->
    <div class="cd-popup">
        <div class="cd-popup-container">
          <img src="/style/images/pat/detail.jpg" class="imge">
        </div>
    </div>




    <footer id="footer">
        <div class="footer-left">
            <p>保证Jin ¥ <?=intval($this->data['pat_guarantee_price']) ?></p>
            <span>（未拍到商品，全额秒退）</span>
        </div>
        <!-- style="background-color: #ff0000;  #a7a7a7" -->
        <div class="footer-right">
            <p  id="_buy" onClick = "_getbuy();">去购买<i style="font-size:.4rem;display:block;height: .4rem;
    line-height: .4rem;margin-top: -.03rem;">（挥拍一下）</i></p>
            
        </div>
    </footer>
</div>
<script>
jQuery(document).ready(function($){
    //open popup
    $('.imge').on('click', function(event){
        event.preventDefault();
        $('.cd-popup').addClass('is-visible');
    });

    //close popup
    $('.cd-popup').on('click', function(event){
        if( $(event.target).is('.imge') || $(event.target).is('.cd-popup') ) {
            event.preventDefault();
            $(this).removeClass('is-visible');
        }
    });
    //close popup when clicking the esc keyboard button
    $(document).keyup(function(event){
        if(event.which=='27'){
            $('.cd-popup').removeClass('is-visible');
        }
    });
});
</script>
<script>

     $(function (){

    	updateEndTime();
      }) 
    $('.switch-menu a').click(function() {
        var i = $(this).index();//下标第一种写法
        //var i = $('tit').index(this);//下标第二种写法
        $(this).addClass('coo').siblings().removeClass('coo');
        $('.swiper-container .swiper-wrapper').eq(i).show().siblings().hide();
    });
    var time = <?=$this->data['time']?>;
    var endTime= <?=$this->data['pat_count_down']?>;
//d
    function updateEndTime()
    {
        var lag = (endTime - time); //当前时间和结束时间之间的秒数
        if(lag > 0)
        {
        	
          endTime -= 1;
       	 var secondTime = parseInt(lag);// 秒
         var minuteTime = 0;// 分
         var hourTime = 0;// 小时
         if(secondTime > 60) {//如果秒数大于60，将秒数转换成整数
             //获取分钟，除以60取整数，得到整数分钟
             minuteTime = parseInt(secondTime / 60);
             //获取秒数，秒数取佘，得到整数秒数
             secondTime = parseInt(secondTime % 60);
             secondTime = PrefixInteger(secondTime,2);
             //如果分钟大于60，将分钟转换成小时
             if(minuteTime > 60) {
                 //获取小时，获取分钟除以60，得到整数小时
                 hourTime = parseInt(minuteTime / 60);
                 hourTime = PrefixInteger(hourTime,2);
                 //获取小时后取佘的分，获取分钟除以60取佘的分
                 minuteTime = parseInt(minuteTime % 60);
                 minuteTime = PrefixInteger(minuteTime,2);
             }
         }
         var result = "" + secondTime;

         if(minuteTime > 0) {
        	
             result = "" + minuteTime + ":" + result;
         }
         if(hourTime > 0) {
             result = "" + hourTime + ":" + result;
         }
        
           $('.down_time').html(result);
        }
        else
        {
         
       	   $('.down_time').html(0);
           
        }
   
      setTimeout("updateEndTime()",1000);
    }

    var lags = 5; 
    var stat=false;
    function _getbuy(){
    	if(!stat){
       
        	payEndTime();
        	stat = true;
   	       $.ajax({
               type: "POST",
               url: "ajax",
               data: {
                   "act": "pat_buy",
                   "goods_id":<?=$this->data['goods_id'];?>,
                   "mr": Math.random()
               },
               dataType: "json",
               success: function(data) {
                   if (data.code == 200) {
                       
                       $('#new_price').html(data.price);
                       swal(data.msg,false, "success");
                       setTimeout(function() {
                    	   window.location.reload();
                       }, 5000);
                   } else {

                       if(data.code==904 || data.code==916){
                   	    swal({
                	        title: data.msg,
                	        type: "warning",
                	        timer: 30000,
                	        showCancelButton: true,
                	        confirmButtonText: "充值",
                	        cancelButtonText: "取消",
                	        closeOnConfirm: false,
                	        closeOnCancel: true
                	    }, function(isConfirm) {
                	        if (isConfirm) {
                	        	window.location.href="/onermb/coins_recharge"
                	        }
                	    });
                	                            
                         }else{
                       	   swal(data.msg+'['+data.code+']', false, "error");

                         }
                   }
               }
           });
       } 
    }

    function PrefixInteger(num, length) {
        return (Array(length).join('0') + num).slice(-length);
    }
      function payEndTime()
    {
        
        if(lags > 0)
        {
        	
        	
       	   $('.footer-right').css({"background-color":"#a7a7a7","padding-top":".3rem"});
           $('#_buy').html(lags+"秒");
           lags -= 1;
           setTimeout("payEndTime()",1000);
        }
        else
        {
       	   
        	stat = false;
        	lags = 5;
        	window.location.reload();
        	
        }
       
    
    } 





</script>

</body>
</html>